package resolvers

import (
	"context"
	"happy-sudoku/internal/model"
)

type roomRootResolver struct{ *RootResolver }

func (r *roomRootResolver) Host(ctx context.Context, obj *model.Room) (*model.Player, error) {
	return r.playerSrv.GetOne(ctx, obj.HostID)
}

func (r *roomRootResolver) Players(ctx context.Context, obj *model.Room) ([]*model.Player, error) {
	return r.playerSrv.GetList(ctx, obj.PlayersID)
}

func (r *roomRootResolver) Setting(ctx context.Context, obj *model.Room) (*model.RoomSetting, error) {
	// !! TODO: Find why we need obj.Setting
	return obj.Setting, nil
}

func (r *roomRootResolver) Puzzle(ctx context.Context, obj *model.Room) (*model.Puzzle, error) {
	return r.puzzleSrv.GetOne(obj.PuzzleID)
}
